
<html>
    <head>
        <title>Shopping Cart</title>
        <style>
            *{ font-size: 12px; font-family:Verdana}
            input {border: 1px solid #ccc}
        </style>
    </head>
    <body>
        <jsp:declaration>
            java.util.Enumeration parms;
            java.util.Enumeration values;
        </jsp:declaration>

        <jsp:scriptlet>
            parms = request.getParameterNames();
            values = request.getParameterNames();

            while(parms.hasMoreElements()){
                String name = (String) parms.nextElement();
                String value = (String) values.nextElement();
                session.setAttribute(name, value);
            }
        </jsp:scriptlet>

        <img src="images/add.png" onclick="document.location='index.jsp'">
        <img src="images/remove.png" onclick="document.location='remove.jsp'">
        <img src="images/cart.png" onclick="document.location='cart.jsp'">

        <h2>Add to Shopping Cart</h2>

        <form method="get" action="index.jsp">
            <table>
                <tr>
                    <td><input type="checkbox" <% if(session.getAttribute("scissors") != null)
                        out.print("checked"); %> name="scissors"></td>
                    <td>Scissors</td>
                </tr>
                <tr>
                    <td><input type="checkbox" <% if(session.getAttribute("book") != null)
                        out.print("checked"); %> name="book"></td>
                    <td>Book</td>
                </tr>
                <tr>
                    <td><input type="checkbox" <% if(session.getAttribute("pen") != null)
                        out.print("checked"); %> name="pen"></td>
                    <td>Pen</td>
                </tr>
                <tr>
                    <td><input type="checkbox" <% if(session.getAttribute("bottle") != null)
                        out.print("checked"); %> name="bottle"></td>
                    <td>Bottle</td>
                </tr>
                <tr>
                    <td><input type="checkbox" <% if(session.getAttribute("glass") != null)
                        out.print("checked"); %> name="glass"></td>
                    <td>Glass</td>
                </tr>
                <tr>
                    <td><input type="checkbox" <% if(session.getAttribute("thaodd") != null)
                        out.print("checked"); %> name="thaodd"></td>
                    <td>Thaodd</td>
                </tr>
            </table>
            <br><br>
            <input type="submit" value="Submit">
        </form>

    </body>
</html>
